home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML Instance.sea / XML Instance / Required / ccs_util.jar / test / ui / TestRunner.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-12-09  |  22.5 KB  |  1,030 lines

  1. package test.ui;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Button;
  5. import java.awt.Color;
  6. import java.awt.Component;
  7. import java.awt.Container;
  8. import java.awt.Dialog;
  9. import java.awt.Font;
  10. import java.awt.Frame;
  11. import java.awt.GridBagConstraints;
  12. import java.awt.GridBagLayout;
  13. import java.awt.Insets;
  14. import java.awt.Label;
  15. import java.awt.List;
  16. import java.awt.Panel;
  17. import java.awt.SystemColor;
  18. import java.awt.TextField;
  19. import java.awt.Window;
  20. import java.awt.event.ActionEvent;
  21. import java.awt.event.ActionListener;
  22. import java.awt.event.ItemEvent;
  23. import java.awt.event.ItemListener;
  24. import java.awt.event.MouseEvent;
  25. import java.awt.event.MouseListener;
  26. import java.awt.event.TextEvent;
  27. import java.awt.event.TextListener;
  28. import java.awt.event.WindowEvent;
  29. import java.awt.event.WindowListener;
  30. import java.lang.reflect.Constructor;
  31. import java.lang.reflect.Method;
  32. import java.util.EventObject;
  33. import java.util.Vector;
  34. import test.framework.Test;
  35. import test.framework.TestResult;
  36.  
  37. public class TestRunner extends Frame implements ActionListener, ItemListener, MouseListener, TextListener, WindowListener, Runnable {
  38.    private Vector fExceptions;
  39.    private Thread fRunner;
  40.    private TestResult fTestResult;
  41.    private Test fTestSuite;
  42.    private TraceFrame fTraceFrame;
  43.    private Label ivjerrorLabel;
  44.    private Label ivjfailureLabel;
  45.    private List ivjFailureList;
  46.    private Label ivjLabel1;
  47.    private Label ivjLabel3;
  48.    private Label ivjLabel5;
  49.    private Logo ivjLogo1;
  50.    private Label ivjNumberOfErrors;
  51.    private Label ivjNumberOfFailures;
  52.    private Label ivjNumberOfRuns;
  53.    private Panel ivjPanel1;
  54.    private Panel ivjPanel2;
  55.    private Button ivjQuitButton;
  56.    private Button ivjrun;
  57.    private Button ivjShowErrorButton;
  58.    private TestStatus ivjStatusIndicator;
  59.    private TextField ivjStatusLine;
  60.    private TextField ivjSuiteField;
  61.    private Label ivjsuiteLabel;
  62.    private BorderLayout ivjTestRunnerBorderLayout;
  63.    private Label ivjtotalLabel;
  64.    // $FF: synthetic field
  65.    static Class class$java$awt$Window;
  66.  
  67.    public TestRunner() {
  68.       this.initialize();
  69.    }
  70.  
  71.    public TestRunner(String title) {
  72.       super(title);
  73.    }
  74.  
  75.    private void about() {
  76.       AboutDialog about = new AboutDialog(this);
  77.       ((Dialog)about).setModal(true);
  78.       ((Component)about).move(200, 200);
  79.       ((Component)about).setVisible(true);
  80.    }
  81.  
  82.    public void actionPerformed(ActionEvent e) {
  83.       if (((EventObject)e).getSource() == this.getrun()) {
  84.          this.conn1(e);
  85.       }
  86.  
  87.       if (((EventObject)e).getSource() == this.getShowErrorButton()) {
  88.          this.conn3(e);
  89.       }
  90.  
  91.       if (((EventObject)e).getSource() == this.getSuiteField()) {
  92.          this.conn6(e);
  93.       }
  94.  
  95.       if (((EventObject)e).getSource() == this.getQuitButton()) {
  96.          this.conn7(e);
  97.       }
  98.  
  99.    }
  100.  
  101.    public void addError(TestResult result, Test test, Throwable t) {
  102.       this.getNumberOfErrors().setText(Integer.toString(result.testErrors()));
  103.       this.appendFailure("Error", test, t);
  104.    }
  105.  
  106.    public void addFailure(TestResult result, Test test, Throwable t) {
  107.       this.getNumberOfFailures().setText(Integer.toString(result.testFailures()));
  108.       this.appendFailure("Failure", test, t);
  109.    }
  110.  
  111.    private void appendFailure(String kind, Test test, Throwable t) {
  112.       if (t.getMessage() != null) {
  113.          this.getFailureList().add(kind + ": " + test + ":" + t.getMessage());
  114.       } else {
  115.          this.getFailureList().add(kind + ": " + test);
  116.       }
  117.  
  118.       this.fExceptions.addElement(t);
  119.    }
  120.  
  121.    private void clearStatus() {
  122.       this.getStatusLine().setText("");
  123.    }
  124.  
  125.    private void conn0(WindowEvent arg1) {
  126.       try {
  127.          ((Frame)this).dispose();
  128.          System.exit(0);
  129.       } catch (Throwable ivjExc) {
  130.          this.handleException(ivjExc);
  131.       }
  132.  
  133.    }
  134.  
  135.    private void conn1(ActionEvent arg1) {
  136.       try {
  137.          this.runSuite();
  138.       } catch (Throwable ivjExc) {
  139.          this.handleException(ivjExc);
  140.       }
  141.  
  142.    }
  143.  
  144.    private void conn14(ActionEvent arg1) {
  145.       try {
  146.          this.showErrorTrace();
  147.       } catch (Throwable ivjExc) {
  148.          this.handleException(ivjExc);
  149.       }
  150.  
  151.    }
  152.  
  153.    private void conn2(TextEvent arg1) {
  154.       try {
  155.          this.suiteNameChanged();
  156.       } catch (Throwable ivjExc) {
  157.          this.handleException(ivjExc);
  158.       }
  159.  
  160.    }
  161.  
  162.    private void conn3(ActionEvent arg1) {
  163.       try {
  164.          this.showErrorTrace();
  165.       } catch (Throwable ivjExc) {
  166.          this.handleException(ivjExc);
  167.       }
  168.  
  169.    }
  170.  
  171.    private void conn3(ItemEvent arg1) {
  172.       try {
  173.          this.listSelectionChanged();
  174.       } catch (Throwable ivjExc) {
  175.          this.handleException(ivjExc);
  176.       }
  177.  
  178.    }
  179.  
  180.    private void conn4(ItemEvent arg1) {
  181.       try {
  182.          this.listSelectionChanged();
  183.       } catch (Throwable ivjExc) {
  184.          this.handleException(ivjExc);
  185.       }
  186.  
  187.    }
  188.  
  189.    private void conn4(TextEvent arg1) {
  190.       try {
  191.          this.suiteNameChanged();
  192.       } catch (Throwable ivjExc) {
  193.          this.handleException(ivjExc);
  194.       }
  195.  
  196.    }
  197.  
  198.    private void conn5(MouseEvent arg1) {
  199.       try {
  200.          if (arg1.getClickCount() != 2) {
  201.             return;
  202.          }
  203.  
  204.          this.showErrorTrace();
  205.       } catch (Throwable ivjExc) {
  206.          this.handleException(ivjExc);
  207.       }
  208.  
  209.    }
  210.  
  211.    private void conn6(ActionEvent arg1) {
  212.       try {
  213.          this.runSuite();
  214.       } catch (Throwable ivjExc) {
  215.          this.handleException(ivjExc);
  216.       }
  217.  
  218.    }
  219.  
  220.    private void conn7(ActionEvent arg1) {
  221.       try {
  222.          this.quit();
  223.       } catch (Throwable ivjExc) {
  224.          this.handleException(ivjExc);
  225.       }
  226.  
  227.    }
  228.  
  229.    private void conn8(MouseEvent arg1) {
  230.       try {
  231.          this.about();
  232.       } catch (Throwable ivjExc) {
  233.          this.handleException(ivjExc);
  234.       }
  235.  
  236.    }
  237.  
  238.    public void endTest(TestResult result, Test test) {
  239.       this.setLabelValue(this.getNumberOfRuns(), result.runTests());
  240.       this.getStatusIndicator().step(result.wasSuccessful());
  241.    }
  242.  
  243.    private Label geterrorLabel() {
  244.       if (this.ivjerrorLabel == null) {
  245.          try {
  246.             this.ivjerrorLabel = new Label();
  247.             this.ivjerrorLabel.setName("errorLabel");
  248.             this.ivjerrorLabel.setText("Errors:");
  249.          } catch (Throwable ivjExc) {
  250.             this.handleException(ivjExc);
  251.          }
  252.       }
  253.  
  254.       return this.ivjerrorLabel;
  255.    }
  256.  
  257.    private Label getfailureLabel() {
  258.       if (this.ivjfailureLabel == null) {
  259.          try {
  260.             this.ivjfailureLabel = new Label();
  261.             this.ivjfailureLabel.setName("failureLabel");
  262.             this.ivjfailureLabel.setText("Failures:");
  263.          } catch (Throwable ivjExc) {
  264.             this.handleException(ivjExc);
  265.          }
  266.       }
  267.  
  268.       return this.ivjfailureLabel;
  269.    }
  270.  
  271.    private List getFailureList() {
  272.       if (this.ivjFailureList == null) {
  273.          try {
  274.             this.ivjFailureList = new List(6);
  275.             this.ivjFailureList.setName("FailureList");
  276.          } catch (Throwable ivjExc) {
  277.             this.handleException(ivjExc);
  278.          }
  279.       }
  280.  
  281.       return this.ivjFailureList;
  282.    }
  283.  
  284.    private Label getLabel1() {
  285.       if (this.ivjLabel1 == null) {
  286.          try {
  287.             this.ivjLabel1 = new Label();
  288.             this.ivjLabel1.setName("Label1");
  289.             this.ivjLabel1.setText("Progress:");
  290.          } catch (Throwable ivjExc) {
  291.             this.handleException(ivjExc);
  292.          }
  293.       }
  294.  
  295.       return this.ivjLabel1;
  296.    }
  297.  
  298.    private Label getLabel3() {
  299.       if (this.ivjLabel3 == null) {
  300.          try {
  301.             this.ivjLabel3 = new Label();
  302.             this.ivjLabel3.setName("Label3");
  303.             this.ivjLabel3.setFont(new Font("dialog", 1, 12));
  304.             this.ivjLabel3.setText(".suite( )");
  305.          } catch (Throwable ivjExc) {
  306.             this.handleException(ivjExc);
  307.          }
  308.       }
  309.  
  310.       return this.ivjLabel3;
  311.    }
  312.  
  313.    private Label getLabel5() {
  314.       if (this.ivjLabel5 == null) {
  315.          try {
  316.             this.ivjLabel5 = new Label();
  317.             this.ivjLabel5.setName("Label5");
  318.             this.ivjLabel5.setText("Errors and Failures:");
  319.          } catch (Throwable ivjExc) {
  320.             this.handleException(ivjExc);
  321.          }
  322.       }
  323.  
  324.       return this.ivjLabel5;
  325.    }
  326.  
  327.    private Logo getLogo1() {
  328.       if (this.ivjLogo1 == null) {
  329.          try {
  330.             this.ivjLogo1 = new Logo();
  331.             this.ivjLogo1.setName("Logo1");
  332.          } catch (Throwable ivjExc) {
  333.             this.handleException(ivjExc);
  334.          }
  335.       }
  336.  
  337.       return this.ivjLogo1;
  338.    }
  339.  
  340.    private Label getNumberOfErrors() {
  341.       if (this.ivjNumberOfErrors == null) {
  342.          try {
  343.             this.ivjNumberOfErrors = new Label();
  344.             this.ivjNumberOfErrors.setName("NumberOfErrors");
  345.             this.ivjNumberOfErrors.setFont(new Font("dialog", 1, 12));
  346.             this.ivjNumberOfErrors.setAlignment(0);
  347.             this.ivjNumberOfErrors.setText("10000");
  348.          } catch (Throwable ivjExc) {
  349.             this.handleException(ivjExc);
  350.          }
  351.       }
  352.  
  353.       return this.ivjNumberOfErrors;
  354.    }
  355.  
  356.    private Label getNumberOfFailures() {
  357.       if (this.ivjNumberOfFailures == null) {
  358.          try {
  359.             this.ivjNumberOfFailures = new Label();
  360.             this.ivjNumberOfFailures.setName("NumberOfFailures");
  361.             this.ivjNumberOfFailures.setFont(new Font("dialog", 1, 12));
  362.             this.ivjNumberOfFailures.setText("10000");
  363.          } catch (Throwable ivjExc) {
  364.             this.handleException(ivjExc);
  365.          }
  366.       }
  367.  
  368.       return this.ivjNumberOfFailures;
  369.    }
  370.  
  371.    private Label getNumberOfRuns() {
  372.       if (this.ivjNumberOfRuns == null) {
  373.          try {
  374.             this.ivjNumberOfRuns = new Label();
  375.             this.ivjNumberOfRuns.setName("NumberOfRuns");
  376.             this.ivjNumberOfRuns.setFont(new Font("dialog", 1, 12));
  377.             this.ivjNumberOfRuns.setText("10000");
  378.          } catch (Throwable ivjExc) {
  379.             this.handleException(ivjExc);
  380.          }
  381.       }
  382.  
  383.       return this.ivjNumberOfRuns;
  384.    }
  385.  
  386.    private Panel getPanel1() {
  387.       GridBagConstraints constraintssuiteLabel = new GridBagConstraints();
  388.       GridBagConstraints constraintsSuiteField = new GridBagConstraints();
  389.       GridBagConstraints constraintsrun = new GridBagConstraints();
  390.       GridBagConstraints constraintsLabel5 = new GridBagConstraints();
  391.       GridBagConstraints constraintsFailureList = new GridBagConstraints();
  392.       GridBagConstraints constraintsShowErrorButton = new GridBagConstraints();
  393.       GridBagConstraints constraintsStatusLine = new GridBagConstraints();
  394.       GridBagConstraints constraintsPanel2 = new GridBagConstraints();
  395.       GridBagConstraints constraintsQuitButton = new GridBagConstraints();
  396.       GridBagConstraints constraintsStatusIndicator = new GridBagConstraints();
  397.       GridBagConstraints constraintsLogo1 = new GridBagConstraints();
  398.       GridBagConstraints constraintsLabel1 = new GridBagConstraints();
  399.       GridBagConstraints constraintsLabel3 = new GridBagConstraints();
  400.       if (this.ivjPanel1 == null) {
  401.          try {
  402.             this.ivjPanel1 = new Panel();
  403.             this.ivjPanel1.setName("Panel1");
  404.             this.ivjPanel1.setLayout(new GridBagLayout());
  405.             this.ivjPanel1.setBackground(SystemColor.control);
  406.             constraintssuiteLabel.gridx = 1;
  407.             constraintssuiteLabel.gridy = 0;
  408.             constraintssuiteLabel.gridwidth = 2;
  409.             constraintssuiteLabel.gridheight = 1;
  410.             constraintssuiteLabel.fill = 2;
  411.             constraintssuiteLabel.anchor = 17;
  412.             constraintssuiteLabel.weightx = (double)0.0F;
  413.             constraintssuiteLabel.weighty = (double)0.0F;
  414.             constraintssuiteLabel.ipadx = 4;
  415.             constraintssuiteLabel.ipady = 4;
  416.             constraintssuiteLabel.insets = new Insets(0, 8, 0, 8);
  417.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getsuiteLabel(), constraintssuiteLabel);
  418.             this.getPanel1().add(this.getsuiteLabel());
  419.             constraintsSuiteField.gridx = 1;
  420.             constraintsSuiteField.gridy = 2;
  421.             constraintsSuiteField.gridwidth = 1;
  422.             constraintsSuiteField.gridheight = 1;
  423.             constraintsSuiteField.fill = 2;
  424.             constraintsSuiteField.anchor = 10;
  425.             constraintsSuiteField.weightx = (double)1.0F;
  426.             constraintsSuiteField.weighty = (double)0.0F;
  427.             constraintsSuiteField.insets = new Insets(0, 8, 0, 2);
  428.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getSuiteField(), constraintsSuiteField);
  429.             this.getPanel1().add(this.getSuiteField());
  430.             constraintsrun.gridx = 5;
  431.             constraintsrun.gridy = 2;
  432.             constraintsrun.gridwidth = 1;
  433.             constraintsrun.gridheight = 1;
  434.             constraintsrun.fill = 2;
  435.             constraintsrun.anchor = 17;
  436.             constraintsrun.weightx = (double)0.0F;
  437.             constraintsrun.weighty = (double)0.0F;
  438.             constraintsrun.insets = new Insets(0, 0, 0, 8);
  439.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getrun(), constraintsrun);
  440.             this.getPanel1().add(this.getrun());
  441.             constraintsLabel5.gridx = 1;
  442.             constraintsLabel5.gridy = 10;
  443.             constraintsLabel5.gridwidth = 2;
  444.             constraintsLabel5.gridheight = 1;
  445.             constraintsLabel5.fill = 2;
  446.             constraintsLabel5.anchor = 10;
  447.             constraintsLabel5.weightx = (double)0.0F;
  448.             constraintsLabel5.weighty = (double)0.0F;
  449.             constraintsLabel5.ipadx = 4;
  450.             constraintsLabel5.ipady = 4;
  451.             constraintsLabel5.insets = new Insets(0, 8, 0, 8);
  452.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getLabel5(), constraintsLabel5);
  453.             this.getPanel1().add(this.getLabel5());
  454.             constraintsFailureList.gridx = 1;
  455.             constraintsFailureList.gridy = 12;
  456.             constraintsFailureList.gridwidth = 4;
  457.             constraintsFailureList.gridheight = 2;
  458.             constraintsFailureList.fill = 1;
  459.             constraintsFailureList.anchor = 10;
  460.             constraintsFailureList.weightx = (double)0.0F;
  461.             constraintsFailureList.weighty = (double)1.0F;
  462.             constraintsFailureList.insets = new Insets(0, 8, 0, 8);
  463.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getFailureList(), constraintsFailureList);
  464.             this.getPanel1().add(this.getFailureList());
  465.             constraintsShowErrorButton.gridx = 5;
  466.             constraintsShowErrorButton.gridy = 13;
  467.             constraintsShowErrorButton.gridwidth = 1;
  468.             constraintsShowErrorButton.gridheight = 1;
  469.             constraintsShowErrorButton.fill = 2;
  470.             constraintsShowErrorButton.anchor = 10;
  471.             constraintsShowErrorButton.weightx = (double)0.0F;
  472.             constraintsShowErrorButton.weighty = (double)0.0F;
  473.             constraintsShowErrorButton.insets = new Insets(0, 0, 0, 8);
  474.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getShowErrorButton(), constraintsShowErrorButton);
  475.             this.getPanel1().add(this.getShowErrorButton());
  476.             constraintsStatusLine.gridx = 0;
  477.             constraintsStatusLine.gridy = 15;
  478.             constraintsStatusLine.gridwidth = 5;
  479.             constraintsStatusLine.gridheight = 1;
  480.             constraintsStatusLine.fill = 2;
  481.             constraintsStatusLine.anchor = 10;
  482.             constraintsStatusLine.weightx = (double)1.0F;
  483.             constraintsStatusLine.weighty = (double)0.0F;
  484.             constraintsStatusLine.insets = new Insets(8, 8, 8, 8);
  485.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getStatusLine(), constraintsStatusLine);
  486.             this.getPanel1().add(this.getStatusLine());
  487.             constraintsPanel2.gridx = 1;
  488.             constraintsPanel2.gridy = 8;
  489.             constraintsPanel2.gridwidth = 4;
  490.             constraintsPanel2.gridheight = 1;
  491.             constraintsPanel2.fill = 1;
  492.             constraintsPanel2.anchor = 17;
  493.             constraintsPanel2.weightx = (double)1.0F;
  494.             constraintsPanel2.weighty = (double)0.0F;
  495.             constraintsPanel2.insets = new Insets(0, 0, 0, 8);
  496.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getPanel2(), constraintsPanel2);
  497.             this.getPanel1().add(this.getPanel2());
  498.             constraintsQuitButton.gridx = 5;
  499.             constraintsQuitButton.gridy = 15;
  500.             constraintsQuitButton.gridwidth = 1;
  501.             constraintsQuitButton.gridheight = 1;
  502.             constraintsQuitButton.fill = 2;
  503.             constraintsQuitButton.anchor = 10;
  504.             constraintsQuitButton.weightx = (double)0.0F;
  505.             constraintsQuitButton.weighty = (double)0.0F;
  506.             constraintsQuitButton.insets = new Insets(0, 0, 0, 8);
  507.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getQuitButton(), constraintsQuitButton);
  508.             this.getPanel1().add(this.getQuitButton());
  509.             constraintsStatusIndicator.gridx = 1;
  510.             constraintsStatusIndicator.gridy = 5;
  511.             constraintsStatusIndicator.gridwidth = 4;
  512.             constraintsStatusIndicator.gridheight = 1;
  513.             constraintsStatusIndicator.fill = 2;
  514.             constraintsStatusIndicator.anchor = 10;
  515.             constraintsStatusIndicator.weightx = (double)0.0F;
  516.             constraintsStatusIndicator.weighty = (double)0.0F;
  517.             constraintsStatusIndicator.insets = new Insets(0, 8, 8, 8);
  518.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getStatusIndicator(), constraintsStatusIndicator);
  519.             this.getPanel1().add(this.getStatusIndicator());
  520.             constraintsLogo1.gridx = 5;
  521.             constraintsLogo1.gridy = 5;
  522.             constraintsLogo1.gridwidth = 1;
  523.             constraintsLogo1.gridheight = 4;
  524.             constraintsLogo1.anchor = 11;
  525.             constraintsLogo1.weightx = (double)0.0F;
  526.             constraintsLogo1.weighty = (double)0.0F;
  527.             constraintsLogo1.insets = new Insets(8, 4, 0, 0);
  528.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getLogo1(), constraintsLogo1);
  529.             this.getPanel1().add(this.getLogo1());
  530.             constraintsLabel1.gridx = 1;
  531.             constraintsLabel1.gridy = 3;
  532.             constraintsLabel1.gridwidth = 2;
  533.             constraintsLabel1.gridheight = 1;
  534.             constraintsLabel1.anchor = 17;
  535.             constraintsLabel1.weightx = (double)0.0F;
  536.             constraintsLabel1.weighty = (double)0.0F;
  537.             constraintsLabel1.insets = new Insets(4, 8, 0, 4);
  538.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getLabel1(), constraintsLabel1);
  539.             this.getPanel1().add(this.getLabel1());
  540.             constraintsLabel3.gridx = 2;
  541.             constraintsLabel3.gridy = 2;
  542.             constraintsLabel3.gridwidth = 1;
  543.             constraintsLabel3.gridheight = 1;
  544.             constraintsLabel3.anchor = 17;
  545.             constraintsLabel3.weightx = (double)0.0F;
  546.             constraintsLabel3.weighty = (double)0.0F;
  547.             ((GridBagLayout)this.getPanel1().getLayout()).setConstraints(this.getLabel3(), constraintsLabel3);
  548.             this.getPanel1().add(this.getLabel3());
  549.          } catch (Throwable ivjExc) {
  550.             this.handleException(ivjExc);
  551.          }
  552.       }
  553.  
  554.       return this.ivjPanel1;
  555.    }
  556.  
  557.    private Panel getPanel2() {
  558.       GridBagConstraints constraintstotalLabel = new GridBagConstraints();
  559.       GridBagConstraints constraintsNumberOfRuns = new GridBagConstraints();
  560.       GridBagConstraints constraintserrorLabel = new GridBagConstraints();
  561.       GridBagConstraints constraintsNumberOfErrors = new GridBagConstraints();
  562.       GridBagConstraints constraintsfailureLabel = new GridBagConstraints();
  563.       GridBagConstraints constraintsNumberOfFailures = new GridBagConstraints();
  564.       if (this.ivjPanel2 == null) {
  565.          try {
  566.             this.ivjPanel2 = new Panel();
  567.             this.ivjPanel2.setName("Panel2");
  568.             this.ivjPanel2.setLayout(new GridBagLayout());
  569.             constraintstotalLabel.gridx = 0;
  570.             constraintstotalLabel.gridy = 0;
  571.             constraintstotalLabel.gridwidth = 1;
  572.             constraintstotalLabel.gridheight = 1;
  573.             constraintstotalLabel.anchor = 17;
  574.             constraintstotalLabel.weightx = (double)0.0F;
  575.             constraintstotalLabel.weighty = (double)0.0F;
  576.             ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.gettotalLabel(), constraintstotalLabel);
  577.             this.getPanel2().add(this.gettotalLabel());
  578.             constraintsNumberOfRuns.gridx = -1;
  579.             constraintsNumberOfRuns.gridy = -1;
  580.             constraintsNumberOfRuns.gridwidth = 1;
  581.             constraintsNumberOfRuns.gridheight = 1;
  582.             constraintsNumberOfRuns.anchor = 10;
  583.             constraintsNumberOfRuns.weightx = (double)0.0F;
  584.             constraintsNumberOfRuns.weighty = (double)0.0F;
  585.             ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.getNumberOfRuns(), constraintsNumberOfRuns);
  586.             this.getPanel2().add(this.getNumberOfRuns());
  587.             constraintserrorLabel.gridx = -1;
  588.             constraintserrorLabel.gridy = -1;
  589.             constraintserrorLabel.gridwidth = 1;
  590.             constraintserrorLabel.gridheight = 1;
  591.             constraintserrorLabel.anchor = 10;
  592.             constraintserrorLabel.weightx = (double)0.0F;
  593.             constraintserrorLabel.weighty = (double)0.0F;
  594.             ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.geterrorLabel(), constraintserrorLabel);
  595.             this.getPanel2().add(this.geterrorLabel());
  596.             constraintsNumberOfErrors.gridx = -1;
  597.             constraintsNumberOfErrors.gridy = -1;
  598.             constraintsNumberOfErrors.gridwidth = 1;
  599.             constraintsNumberOfErrors.gridheight = 1;
  600.             constraintsNumberOfErrors.anchor = 10;
  601.             constraintsNumberOfErrors.weightx = (double)0.0F;
  602.             constraintsNumberOfErrors.weighty = (double)0.0F;
  603.             ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.getNumberOfErrors(), constraintsNumberOfErrors);
  604.             this.getPanel2().add(this.getNumberOfErrors());
  605.             constraintsfailureLabel.gridx = -1;
  606.             constraintsfailureLabel.gridy = -1;
  607.             constraintsfailureLabel.gridwidth = 1;
  608.             constraintsfailureLabel.gridheight = 1;
  609.             constraintsfailureLabel.anchor = 10;
  610.             constraintsfailureLabel.weightx = (double)0.0F;
  611.             constraintsfailureLabel.weighty = (double)0.0F;
  612.             ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.getfailureLabel(), constraintsfailureLabel);
  613.             this.getPanel2().add(this.getfailureLabel());
  614.             constraintsNumberOfFailures.gridx = -1;
  615.             constraintsNumberOfFailures.gridy = -1;
  616.             constraintsNumberOfFailures.gridwidth = 1;
  617.             constraintsNumberOfFailures.gridheight = 1;
  618.             constraintsNumberOfFailures.anchor = 10;
  619.             constraintsNumberOfFailures.weightx = (double)0.0F;
  620.             constraintsNumberOfFailures.weighty = (double)0.0F;
  621.             ((GridBagLayout)this.getPanel2().getLayout()).setConstraints(this.getNumberOfFailures(), constraintsNumberOfFailures);
  622.             this.getPanel2().add(this.getNumberOfFailures());
  623.          } catch (Throwable ivjExc) {
  624.             this.handleException(ivjExc);
  625.          }
  626.       }
  627.  
  628.       return this.ivjPanel2;
  629.    }
  630.  
  631.    private Button getQuitButton() {
  632.       if (this.ivjQuitButton == null) {
  633.          try {
  634.             this.ivjQuitButton = new Button();
  635.             this.ivjQuitButton.setName("QuitButton");
  636.             this.ivjQuitButton.setLabel("Quit");
  637.          } catch (Throwable ivjExc) {
  638.             this.handleException(ivjExc);
  639.          }
  640.       }
  641.  
  642.       return this.ivjQuitButton;
  643.    }
  644.  
  645.    private Button getrun() {
  646.       if (this.ivjrun == null) {
  647.          try {
  648.             this.ivjrun = new Button();
  649.             this.ivjrun.setName("run");
  650.             this.ivjrun.setEnabled(false);
  651.             this.ivjrun.setLabel("Run");
  652.          } catch (Throwable ivjExc) {
  653.             this.handleException(ivjExc);
  654.          }
  655.       }
  656.  
  657.       return this.ivjrun;
  658.    }
  659.  
  660.    private Button getShowErrorButton() {
  661.       if (this.ivjShowErrorButton == null) {
  662.          try {
  663.             this.ivjShowErrorButton = new Button();
  664.             this.ivjShowErrorButton.setName("ShowErrorButton");
  665.             this.ivjShowErrorButton.setEnabled(false);
  666.             this.ivjShowErrorButton.setActionCommand("Show...");
  667.             this.ivjShowErrorButton.setLabel("Show...");
  668.          } catch (Throwable ivjExc) {
  669.             this.handleException(ivjExc);
  670.          }
  671.       }
  672.  
  673.       return this.ivjShowErrorButton;
  674.    }
  675.  
  676.    private TestStatus getStatusIndicator() {
  677.       if (this.ivjStatusIndicator == null) {
  678.          try {
  679.             this.ivjStatusIndicator = new TestStatus();
  680.             this.ivjStatusIndicator.setName("StatusIndicator");
  681.          } catch (Throwable ivjExc) {
  682.             this.handleException(ivjExc);
  683.          }
  684.       }
  685.  
  686.       return this.ivjStatusIndicator;
  687.    }
  688.  
  689.    private TextField getStatusLine() {
  690.       if (this.ivjStatusLine == null) {
  691.          try {
  692.             this.ivjStatusLine = new TextField();
  693.             this.ivjStatusLine.setName("StatusLine");
  694.             this.ivjStatusLine.setFont(new Font("dialog", 1, 12));
  695.             this.ivjStatusLine.setEditable(false);
  696.             this.ivjStatusLine.setForeground(Color.red);
  697.          } catch (Throwable ivjExc) {
  698.             this.handleException(ivjExc);
  699.          }
  700.       }
  701.  
  702.       return this.ivjStatusLine;
  703.    }
  704.  
  705.    private TextField getSuiteField() {
  706.       if (this.ivjSuiteField == null) {
  707.          try {
  708.             this.ivjSuiteField = new TextField();
  709.             this.ivjSuiteField.setName("SuiteField");
  710.             this.ivjSuiteField.setFont(new Font("Dialog", 0, 12));
  711.             this.ivjSuiteField.setColumns(40);
  712.          } catch (Throwable ivjExc) {
  713.             this.handleException(ivjExc);
  714.          }
  715.       }
  716.  
  717.       return this.ivjSuiteField;
  718.    }
  719.  
  720.    private Label getsuiteLabel() {
  721.       if (this.ivjsuiteLabel == null) {
  722.          try {
  723.             this.ivjsuiteLabel = new Label();
  724.             this.ivjsuiteLabel.setName("suiteLabel");
  725.             this.ivjsuiteLabel.setText("Enter the name of the TestCase class:");
  726.          } catch (Throwable ivjExc) {
  727.             this.handleException(ivjExc);
  728.          }
  729.       }
  730.  
  731.       return this.ivjsuiteLabel;
  732.    }
  733.  
  734.    private BorderLayout getTestRunnerBorderLayout() {
  735.       BorderLayout ivjTestRunnerBorderLayout = null;
  736.  
  737.       try {
  738.          ivjTestRunnerBorderLayout = new BorderLayout();
  739.          ivjTestRunnerBorderLayout.setVgap(0);
  740.          ivjTestRunnerBorderLayout.setHgap(0);
  741.       } catch (Throwable ivjExc) {
  742.          this.handleException(ivjExc);
  743.       }
  744.  
  745.       return ivjTestRunnerBorderLayout;
  746.    }
  747.  
  748.    private Label gettotalLabel() {
  749.       if (this.ivjtotalLabel == null) {
  750.          try {
  751.             this.ivjtotalLabel = new Label();
  752.             this.ivjtotalLabel.setName("totalLabel");
  753.             this.ivjtotalLabel.setAlignment(0);
  754.             this.ivjtotalLabel.setText("Runs:");
  755.          } catch (Throwable ivjExc) {
  756.             this.handleException(ivjExc);
  757.          }
  758.       }
  759.  
  760.       return this.ivjtotalLabel;
  761.    }
  762.  
  763.    private void handleException(Throwable exception) {
  764.    }
  765.  
  766.    private void initConnections() {
  767.       ((Window)this).addWindowListener(this);
  768.       this.getrun().addActionListener(this);
  769.       this.getSuiteField().addTextListener(this);
  770.       this.getShowErrorButton().addActionListener(this);
  771.       this.getFailureList().addItemListener(this);
  772.       this.getFailureList().addMouseListener(this);
  773.       this.getSuiteField().addActionListener(this);
  774.       this.getQuitButton().addActionListener(this);
  775.       this.getLogo1().addMouseListener(this);
  776.    }
  777.  
  778.    private void initialize() {
  779.       ((Component)this).setName("TestRunner");
  780.       ((Component)this).setName("TestRunner");
  781.       ((Container)this).setLayout(this.getTestRunnerBorderLayout());
  782.       ((Component)this).setSize(405, 309);
  783.       ((Frame)this).setTitle("Run Test Suite");
  784.       ((Container)this).add("Center", this.getPanel1());
  785.       this.initConnections();
  786.       this.resetCounters();
  787.    }
  788.  
  789.    public void itemStateChanged(ItemEvent e) {
  790.       if (((EventObject)e).getSource() == this.getFailureList()) {
  791.          this.conn4(e);
  792.       }
  793.  
  794.    }
  795.  
  796.    private void listSelectionChanged() {
  797.       this.getShowErrorButton().setEnabled(this.getFailureList().getSelectedIndex() != -1);
  798.    }
  799.  
  800.    public static void main(String[] args) {
  801.       try {
  802.          TestRunner aTestRunner = new TestRunner();
  803.  
  804.          try {
  805.             Class aCloserClass = Class.forName("uvm.abt.edit.WindowCloser");
  806.             Class[] parmTypes = new Class[]{class$java$awt$Window != null ? class$java$awt$Window : (class$java$awt$Window = class$("java.awt.Window"))};
  807.             Object[] parms = new Object[]{aTestRunner};
  808.             Constructor aCtor = aCloserClass.getConstructor(parmTypes);
  809.             aCtor.newInstance(parms);
  810.          } catch (Throwable var6) {
  811.          }
  812.  
  813.          ((Component)aTestRunner).move(200, 200);
  814.          ((Component)aTestRunner).setVisible(true);
  815.          if (args.length == 1) {
  816.             aTestRunner.setSuiteName(args[0]);
  817.             aTestRunner.runSuite();
  818.          }
  819.       } catch (Throwable var7) {
  820.          System.err.println("Exception occurred in main() of java.awt.Frame");
  821.       }
  822.  
  823.    }
  824.  
  825.    public void mouseClicked(MouseEvent e) {
  826.       if (((EventObject)e).getSource() == this.getFailureList()) {
  827.          this.conn5(e);
  828.       }
  829.  
  830.       if (((EventObject)e).getSource() == this.getLogo1()) {
  831.          this.conn8(e);
  832.       }
  833.  
  834.    }
  835.  
  836.    public void mouseEntered(MouseEvent e) {
  837.    }
  838.  
  839.    public void mouseExited(MouseEvent e) {
  840.    }
  841.  
  842.    public void mousePressed(MouseEvent e) {
  843.    }
  844.  
  845.    public void mouseReleased(MouseEvent e) {
  846.    }
  847.  
  848.    private void quit() {
  849.       System.exit(0);
  850.    }
  851.  
  852.    private void reset() {
  853.       this.resetCounters();
  854.       this.clearStatus();
  855.       this.getStatusIndicator().reset();
  856.       this.resetFailureList();
  857.       this.fExceptions = new Vector(10);
  858.    }
  859.  
  860.    private void resetCounters() {
  861.       this.setLabelValue(this.getNumberOfErrors(), 0);
  862.       this.setLabelValue(this.getNumberOfFailures(), 0);
  863.       this.setLabelValue(this.getNumberOfRuns(), 0);
  864.    }
  865.  
  866.    private void resetFailureList() {
  867.       this.getShowErrorButton().setEnabled(false);
  868.       this.getFailureList().removeAll();
  869.    }
  870.  
  871.    public void run() {
  872.       this.getrun().setLabel("Stop");
  873.       this.showInfo("Initializing...");
  874.       this.reset();
  875.       String vendor = System.getProperty("java.vendor");
  876.       if (vendor == null || !vendor.equals("IBM")) {
  877.          this.showInfo("Garbage Collection...");
  878.          Runtime.getRuntime().gc();
  879.       }
  880.  
  881.       this.showInfo("Load Test Case...");
  882.       String suiteClassName = this.getSuiteField().getText();
  883.       Class fixtureClass = null;
  884.       Method suiteMethod = null;
  885.       String methodName = "suite";
  886.  
  887.       try {
  888.          fixtureClass = Class.forName(suiteClassName);
  889.       } catch (Exception var15) {
  890.          this.runFailed("Class \"" + suiteClassName + "\" not found");
  891.          return;
  892.       }
  893.  
  894.       try {
  895.          suiteMethod = fixtureClass.getMethod(methodName);
  896.       } catch (Exception var14) {
  897.          this.runFailed("Class \"" + suiteClassName + "\" has no method named \"" + methodName + "\"");
  898.          return;
  899.       }
  900.  
  901.       try {
  902.          this.fTestSuite = (Test)suiteMethod.invoke((Object)null);
  903.       } catch (Exception var13) {
  904.          this.runFailed("Could not invoke the suite() method");
  905.          return;
  906.       }
  907.  
  908.       this.fTestResult = new UITestResult(this);
  909.       int totalRuns = this.fTestSuite.countTestCases();
  910.       this.getStatusIndicator().start(totalRuns);
  911.       this.showInfo("Running...");
  912.       long startTime = System.currentTimeMillis();
  913.       this.fTestSuite.run(this.fTestResult);
  914.       if (this.fTestResult.shouldStop()) {
  915.          this.showStatus("Stopped");
  916.       } else {
  917.          long endTime = System.currentTimeMillis();
  918.          long runTime = endTime - startTime;
  919.          this.showInfo("Finished: " + runTime / 1000L + "." + runTime % 1000L + " seconds");
  920.       }
  921.  
  922.       this.fRunner = null;
  923.       this.fTestSuite = null;
  924.       this.fTestResult = null;
  925.       this.getrun().setLabel("Run");
  926.    }
  927.  
  928.    private void runFailed(String message) {
  929.       this.showStatus(message);
  930.       this.getrun().setLabel("Run");
  931.       this.fRunner = null;
  932.    }
  933.  
  934.    public void runSuite() {
  935.       if (this.fRunner != null) {
  936.          this.fTestResult.stop();
  937.       } else {
  938.          this.fRunner = new Thread(this);
  939.          this.fRunner.start();
  940.       }
  941.    }
  942.  
  943.    private void setLabelValue(Label label, int value) {
  944.       String text;
  945.       if (value == 0) {
  946.          text = "    0";
  947.       } else {
  948.          text = Integer.toString(value);
  949.       }
  950.  
  951.       label.setText(text);
  952.    }
  953.  
  954.    public void setSuiteName(String suite) {
  955.       this.getSuiteField().setText(suite);
  956.    }
  957.  
  958.    private void showErrorTrace() {
  959.       int index = this.getFailureList().getSelectedIndex();
  960.       if (index != -1) {
  961.          Throwable t = (Throwable)this.fExceptions.elementAt(index);
  962.          if (this.fTraceFrame == null) {
  963.             this.fTraceFrame = new TraceFrame();
  964.             this.fTraceFrame.move(100, 100);
  965.          }
  966.  
  967.          this.fTraceFrame.showTrace(t);
  968.          this.fTraceFrame.setVisible(true);
  969.       }
  970.    }
  971.  
  972.    private void showInfo(String message) {
  973.       this.getStatusLine().setFont(new Font("dialog", 0, 12));
  974.       this.getStatusLine().setForeground(Color.black);
  975.       this.getStatusLine().setText(message);
  976.    }
  977.  
  978.    private void showStatus(String status) {
  979.       this.getStatusLine().setFont(new Font("dialog", 1, 12));
  980.       this.getStatusLine().setForeground(Color.red);
  981.       this.getStatusLine().setText(status);
  982.    }
  983.  
  984.    private void suiteNameChanged() {
  985.       this.getrun().setEnabled(this.getSuiteField().getText().length() != 0);
  986.       this.clearStatus();
  987.    }
  988.  
  989.    public void textValueChanged(TextEvent e) {
  990.       if (((EventObject)e).getSource() == this.getSuiteField()) {
  991.          this.conn2(e);
  992.       }
  993.  
  994.    }
  995.  
  996.    public void windowActivated(WindowEvent e) {
  997.    }
  998.  
  999.    public void windowClosed(WindowEvent e) {
  1000.    }
  1001.  
  1002.    public void windowClosing(WindowEvent e) {
  1003.       if (((EventObject)e).getSource() == this) {
  1004.          this.conn0(e);
  1005.       }
  1006.  
  1007.    }
  1008.  
  1009.    public void windowDeactivated(WindowEvent e) {
  1010.    }
  1011.  
  1012.    public void windowDeiconified(WindowEvent e) {
  1013.    }
  1014.  
  1015.    public void windowIconified(WindowEvent e) {
  1016.    }
  1017.  
  1018.    public void windowOpened(WindowEvent e) {
  1019.    }
  1020.  
  1021.    // $FF: synthetic method
  1022.    static Class class$(String class$) {
  1023.       try {
  1024.          return Class.forName(class$);
  1025.       } catch (ClassNotFoundException forName) {
  1026.          throw new NoClassDefFoundError(((Throwable)forName).getMessage());
  1027.       }
  1028.    }
  1029. }
  1030.